import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
import { BaseEntity } from '../../entities/base.entity';
import { PageOptionsDto } from '../page.dto';
import { CreateDateColumn, UpdateDateColumn } from 'typeorm';

export class RoleDto extends BaseEntity {
  @ApiProperty({
    required: false,
    description: '角色id',
  })
  @IsString()
  @IsOptional()
  id?: '';
  @IsNotEmpty({
    message: '角色名称不能为空',
  })
  @ApiProperty({
    example: 'roleName',
    description: '角色名称',
  })
  roleName: string;

  @IsNotEmpty({
    message: '内容不能为空',
  })
  @ApiProperty({
    example: 'roleCode',
    description: '角色编码',
  })
  roleCode: string;

  @IsNotEmpty({
    message: '内容不能为空',
  })
  @ApiProperty({
    example: 'remark',
    description: '备注',
  })
  remark: string;
}
export class RoleListDto {
  @ApiProperty({
    required: false,
    description: '角色id',
  })
  @IsString()
  @IsOptional()
  id?: '';

  @IsNotEmpty({
    message: '角色名称不能为空',
  })
  @ApiProperty({
    example: 'roleName',
    description: '角色名称',
  })
  roleName: string;

  @IsNotEmpty({
    message: '内容不能为空',
  })
  @ApiProperty({
    example: 'roleCode',
    description: '角色编码',
  })
  roleCode: string;

  @IsNotEmpty({
    message: '内容不能为空',
  })
  @ApiProperty({
    example: 'remark',
    description: '备注',
  })
  remark: string;
}
export class PageSearchRoleDto extends PageOptionsDto {
  @ApiProperty({
    required: false,
    description: '角色id',
  })
  @IsString()
  @IsOptional()
  id?: '';

  @ApiProperty({
    required: false,
    description: '角色名称',
  })
  @IsString()
  @IsOptional()
  roleName?: '';

  @ApiProperty({
    required: false,
    description: '角色唯一标识',
  })
  @IsString()
  @IsOptional()
  roleCode?: '';

  @ApiProperty({
    required: false,
    description: '备注',
  })
  @IsString()
  @IsOptional()
  remark?: '';
}

export class getMenuDto {
  @IsNotEmpty({
    message: '菜单关联id数组不能为空',
  })
  @ApiProperty({
    example: [],
    description: '菜单关联id数组',
  })
  menuIds: string[];
  @IsNotEmpty({
    message: '角色id不能为空',
  })
  @ApiProperty({
    example: 'string',
    description: '角色',
  })
  roleId: string;
}
